<?
class FeedbackAdmin extends Module
{
	function FeedbackAdmin($row)
	{
		Module::Module($row);
		
		CGlobal::$website_title = AZNet::$page['title'];

		if(User::is_admin())
		{
			$cmd=Url::get('cmd');
			
			switch($cmd)
			{
				case 'delete':	
					$this->add_form(new DeleteFeedBackForm());
					break;
				case 'exam':	
					$this->add_form(new ExmamFeedBackForm());
					break;
				case 'unexam':	
					$this->add_form(new UnexmamFeedBackForm());
					break;
				case 'reply':	
					require_once("forms/FeedbackReply.php")	;
					$this->add_form(new FeedbackReplyForm());
					break;
				default:	
					require_once("forms/FeedbackAdmin.php")	;
					$this->add_form(new FeedbackAdminForm());
					break;
			}
		}
	}
}


class DeleteFeedBackForm extends Form
{
	function DeleteFeedBackForm()
	{
		$id = (int)Url::get('id');
		
		if($id)
		{
			DB::delete('feedback',"id=$id");
		}
		
		URL::redirect_current();			
	}
}

class ExmamFeedBackForm extends Form
{
	function ExmamFeedBackForm()
	{
		$id = (int)Url::get('id',0);
		
		if($id)
		{
			DB::update('feedback',array('status'=>1),'id='.$id);
		}
		
		URL::redirect_current();
	}
}

class UnexmamFeedBackForm extends Form
{
	function UnexmamFeedBackForm()
	{
		$id=	Url::get('id',0);
		
		if($id)
		{
			DB::update('feedback',array('status'=>0),'id='.$id);
		}
		URL::redirect_current();
	}
}
?>